package com.yunqiao.common.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;


/**
 * 统一响应
 * @author Crocutax
 * @email wangxw725@163.com
 * @date 2017-05-18 13:26:52
 */
@Data
@ApiModel(value = "统一响应")
public class ApiResponse<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "返回码")
    private int code;
    @ApiModelProperty(value = "消息内容")
    private String msg;
    @ApiModelProperty(value = "数据实体")
    private T data;

    public ApiResponse() {
        this.code = 0;
        this.msg = "success";
    }

    public ApiResponse(T t) {
        this.code = 0;
        this.msg = "success";
        data = t;
    }

}
